# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=opencascade
pkgver=7.6.2
pkgrel=0
pkgdesc="An SDK for development of applications dealing with 3D CAD data"
url="https://dev.opencascade.org/"
# s390x blocked by vtk -> netcdf
arch="all !s390x"
license="LGPL-2.1-only"
makedepends="
	cmake
	doxygen
	freeimage-dev
	freetype-dev
	libtbb
	libtbb-dev
	libxi-dev
	libxmu-dev
	mesa-dev
	ninja
	tk
	tk-dev
	vtk-dev
	"
subpackages="$pkgname-doc $pkgname-dev"
# remove updatecache on next update
source="$pkgname-$pkgver-updatecache.tar.gz::https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V${pkgver//./_}.tar.gz
	no_mallinfo.patch
	no_feenableexcept.patch
	cmake_fix_install_dir.patch
	cmake_add_buildtype_none.patch
	no_backtrace.patch
	fix-tbb-2021.patch
	"
builddir="$srcdir/OCCT-${pkgver//./_}"
options="!check" # No tests provided :-/

build() {
	# Disabling ffmpeg for now, as VTK already uses ffmpeg in version 5, while OCC only
	# builds with ffmpeg4 right now. vtk-dev depends on ffmpeg-dev which conflics with
	# ffmpeg4-dev. Once patched to build with ffmpeg-dev (not ffmpeg4-dev), ffmpeg support
	# should be re-enabled.
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_GL2PS=OFF \
		-DUSE_FREEIMAGE=ON \
		-DUSE_FFMPEG=OFF \
		-DUSE_VTK=ON \
		-DUSE_TBB=ON \
		-D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk-9.1/
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1339889bb721ff43af00ba0048f0ca41fd5e424339ca6ff147436f67629ce360cfb0a623896608554872a1cfab67e8bcb8df066f4d1458da914aef70ffed0960  opencascade-7.6.2-updatecache.tar.gz
e04cb898ec16c57ea5f2e9e79f6616153b7f6e4ddcad815f5d28898a692e26e1054a8f3321e6ee8616a915b10d45927f5e596c4f096c5333be910eaea751cce3  no_mallinfo.patch
b039b8fce696bfd0f53309a72adab4065780bf1755da6208040157e9383deb0061ad8927a6f160730f431cbebe3fdd1eaa7967b38da4a245a8d9306042d97629  no_feenableexcept.patch
10481f153adf1db55111d68da49dae1885a50e745d3a978f6316b5b13a3f2d7de6a2ed6a3c60c20ef967ea65c16b372da03bf2665ffe4493ad6fe329a3abf368  cmake_fix_install_dir.patch
4bdedc8f0e011530115777cddeeb898750242999725347c3392d8858e5cc9543c791814aa41e1543c575a6a79b0b32fd72970bb83c8948fe42f33993244db1cf  cmake_add_buildtype_none.patch
86dceb6e8309e18f5ea72ce2e3524ff08dc761ffe76557d62a1a4f2824ca0e2f9dfc194cae22164aaaf5ad9a15a6ec0f1fef443241aa2ccb0a2140de217c8a90  no_backtrace.patch
80a5fdfec8159bfcfa2dce8f6635c8567eef64b0b142046ed2b7fc7a77849d14ae9b588b04daf5b5789d18130cbc40c5396af22787f38d8cd425f9f53d1fff9c  fix-tbb-2021.patch
"
